1. Technical Field
Embodiments of the invention relate generally to information processing and more particularly to modification of Xpath queries in Xpath evaluation.
2. Prior Art
The continuing growth of the Internet has led to more and more data being exchanged over the Internet. Internet web sites and web pages are written in a code known as Hypertext Markup Language (HTML) code. HTML documents refer to a mode of displaying a document and are nothing but documents containing hyperlinks. However, HTML documents represent neither the logical structure nor the interrelationships of the data contained within such documents.
To address this shortcoming of HTML documents, Extensible Markup Language (XML) has evolved. XML is a standard for creating markup languages which describe the structure and interrelationships of underlying data contained within an HTML document. Thus, XML is not a single, predefined markup language rather a metalanguage (a language for describing other languages). In day to day commerce situations, an enterprise can use XML to define its business items. For example, items such as goods, prices, customers and so on can be defined using XML. Thus, XML in essence functions like a database of item records in a business scenario.
There are several ways in which XML documents can be processed and data retrieved therefrom. Languages such as XPath, XSLT and XQuery allow performing queries to XML documents to process such documents and locate information contained therein. XPath refers to a standardized language used for mining data from XML documents. XPath treats an XML document as a logical ordered tree and describes how to locate specific elements (and attributes, processing instructions, etc.) in an XML document.
In traditional approaches to XML processing, a Document Object Model (DOM) is followed. In DOM approach, a DOM parser converts the XML document to a tree format and stores this DOM tree in memory. While this approach works in case of smaller documents, it has severe limitations when it comes to processing of larger XML documents especially because the size of the document to be stored is usually 7-10 times the size of the original XML document. Thus, in case of large documents, following the DOM approach is a constraint in terms of memory, time, cost and application performance.
In order to address the challenges posed by DOM approach, alternative approaches such as Simple API for XML (SAX) have evolved. SAX refers to presenting the document as a serialized stream of events. In other words, SAX is event driven and relies on a programmer to specify a particular event. Upon the happening of such specified event, XML processing happens.
An XML filtering system comprises of an Xpath parser and a filtering engine. The XPath parser receives the Xpath queries, parses them and sends the parsed results to the filtering engine which is then converted into an internal representation. During XML processing, an online stream of XML messages are passed through a filtering engine which in turn matches XML documents to user inputted XPath queries and routes the matched XML documents according to XPath queries.
Various filtering approaches are known today, for example, ‘X-filter’ and ‘Y-filter’ algorithms.
According to Y-filter algorithm, a collection of Xpath queries form an Xpath query group which can be applied to the stream of incoming XML messages and can deliver results. Y-filter algorithm combines Xpath queries into a single Nondeterministic Finite Automaton (NFA) and exploits the commonality among the Xpath queries by merging common prefixes of the Xpath query paths such that they are processed at most once. NFA refers to the intermediate data structures generated by parsing Xpath queries. In general, before handling the XML SAX events, the XML filtering system parses the Xpath queries and generates NFA. An arriving XML document is parsed and the events (SAX based events) raised by the XML parser callback the handlers and drive the transitions in the NFA. Advantages of scalability in the approach and query path sharing are achieved by using automata-based filtering approaches.
Typically, in XML filtering systems, a need arises to modify Xpath queries in the Xpath query group when an Xpath evaluation is going on. This situation may occur when a user wants to modify Xpath queries in real-time and he or she wants the modified Xpath query group to be used for the Xpath evaluation. In conventional XML filtering systems, it is not possible to modify an Xpath query when an Xpath evaluation is occurring without interrupting the ongoing XPath evaluation. These conventional XML filtering systems allow modification of Xpath queries only when there is no Xpath evaluation occurring, i.e. an Xpath query can be added to or deleted from a running filtering engine only when the filtering engine is not actively engaged in processing an XML document. This property of the conventional XML filtering systems makes modification of Xpath queries impractical in a real-time environment.
Hence, there is a need to provide a method and system for modifying Xpath queries without interrupting an ongoing Xpath evaluation in a real-time environment.